<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>菜单导航</title>
	<meta name="decorator" content="default"/>
  	<style type="text/css">
  	.menu-text {
  		font-family:'\5FAE\8F6F\96C5\9ED1', arial;
		font-size: 13px;
	}
  	</style>
</head>
<body>
	<c:set var="firstMenu" value="true" />
	<div class="sidebar" id="sidebar">
			<!--#sidebar-shortcuts-->
            <ul class="nav nav-list">
                <c:forEach items="${menuList}" var="menu" varStatus="idxStatus">
                    <c:if test="${menu.parent.id eq parentId }">
                        <c:choose>
                        <c:when test="${ not empty menu.href }">
                            <li class="<c:if test='${firstMenu }'>active</c:if>">
                                <a href="${menu.href}?menuId=${menu.id}">
                                    <i class="menu-icon fa fa-tachometer"></i>
                                    <span class="menu-text"> ${menu.name} </span>
                                </a>
                                <b class="arrow"></b>
                            </li>
                        </c:when>
                        <c:otherwise>
                            <li>
                                <a href="#" class="dropdown-toggle">
                                    <i class="menu-icon fa fa-list"></i>
                                    <span class="menu-text"> ${menu.name } </span>
                                    <b class="arrow fa fa-angle-down"></b>
                                </a>
                                <b class="arrow"></b>
                                <ul class="submenu">
                                    <c:forEach items="${menuList}" var="submenu">
                                        <c:if test="${submenu.parent.id eq menu.id }">
                                            <li class="<c:if test='${firstMenu }'>active</c:if>">
                                                <a href="${ctx }${submenu.href }?menuId=${submenu.id}" target="mainFrame">
                                                    <i class="menu-icon fa fa-caret-right"></i>
                                                    <span class="menu-text">${submenu.name }</span>
                                                </a>
                                                <b class="arrow"></b>
                                            </li>
                                            <c:set var="firstMenu" value="false"/>
                                        </c:if>
                                    </c:forEach>
                                </ul>
                            </li>
                        </c:otherwise>
                        </c:choose>
                    </c:if>
                </c:forEach>
            </ul><!-- /.nav-list -->
		</div>
		<script type="text/javascript">
		$(document).ready(function(){
			$("#sidebar .nav li").click(function(){
				var _this = this;
				if(!$(_this).find("a:first").hasClass("dropdown-toggle")){
					$("#sidebar .nav li.active").removeClass("active");
					$(_this).addClass("active");
				}
			});
			$("ul.nav li a.dropdown-toggle:first").find(".menu-text").click();
			$("#sidebar").find("li.active").find(".menu-text").click();
			
		});
		</script>
</body>
</html>
